Skip to content

Conversation

@StanislavBreadless
Copy link
Collaborator

@StanislavBreadless StanislavBreadless commented Sep 4, 2025

What ❔

This PR makes L2 contracts compatible with ZKsync OS design.
Basically, it means mostly two things

  • No immutables in L2 contracts.
  • No constructors in L2 contracts.

Effectively we split many contracts into L1 and L2 versions, where L2 version doesn't have constructor (instead, it has an initL2 function), and has no immutables.

Why ❔

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.

@github-actions
Copy link

Coverage after merging sb-adapting-contracts-for-zksync-os-v30 into draft-v30 will be

80.25%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
contracts/bridge
   BridgeHelper.sol85.71%100%100%85%31, 36, 41
   BridgedStandardERC20.sol82.14%100%92.31%80.28%120–121, 126–127, 139–140, 164, 205, 212, 219, 229–230, 63, 91
   L1ERC20Bridge.sol94%100%100%93.02%189, 208, 270
   L1Nullifier.sol83.33%100%86.21%82.89%114, 128–130, 160, 221, 224, 234, 237, 247, 250, 418–420, 424–425, 452, 518, 602, 614, 652, 654, 698, 710, 713, 715, 728, 741–742, 746–747, 767
contracts/bridge/asset-router
   AssetRouterBase.sol94.87%100%100%93.75%60, 80
   L1AssetRouter.sol84.54%100%80.65%85.28%216, 254, 270, 357, 368, 399, 438–439, 453, 484, 556, 645, 656, 66, 670, 675, 685–686, 693–694, 697–698, 82, 90
contracts/bridge/interfaces
   AssetHandlerModifiers.sol75%100%100%66.67%13
contracts/bridge/ntv
   L1NativeTokenVault.sol84.62%100%86.36%84.26%146–152, 154, 222–223, 225, 236, 238, 242, 320–321, 68
   NativeTokenVault.sol89.08%100%91.67%88.67%210, 215, 232, 250, 255, 271, 290, 298, 464, 479, 507, 540–541, 545–546, 62, 78
   UpgradeableBeaconDeployer.sol0%100%0%0%15–16, 18, 20–21
contracts/bridgehub
   BridgehubBase.sol83.99%100%86.67%83.52%139, 148, 156, 161–163, 170, 188, 233–234, 242, 245, 254, 264, 277, 292, 321, 345, 348, 407, 423, 454, 534, 714, 718, 722–723, 742, 745, 796, 799, 802, 837, 841, 844, 879–880, 884–885, 893–894, 898–899
   CTMDeploymentTracker.sol73.47%100%81.82%71.05%106, 110, 114, 139, 143–144, 32, 40, 65, 78–79
   ChainAssetHandlerBase.sol73.68%100%75%73.47%105, 119, 122, 132, 177, 225–226, 230–231, 57, 64–65, 73
   L1Bridgehub.sol76.92%100%71.43%78.95%29–30, 67–68
   L1ChainAssetHandler.sol77.78%100%71.43%80%37–38, 46–47
   L1MessageRoot.sol80%100%75%81.82%43–44
   L2Bridgehub.sol75%100%60%80%48–49, 73
   L2ChainAssetHandler.sol80.65%100%75%82.61%49–50, 68, 92
   L2MessageRoot.sol28.57%100%40%26.09%38–39, 43–44, 60, 66–67, 71, 73, 75, 78–79, 81, 85–88
   L2MessageVerification.sol100%100%100%100%
   MessageRootBase.sol57.38%100%66.67%55.10%103–105, 111–113, 121, 130, 136, 148, 158, 163–168, 170–174
contracts/common
   ReentrancyGuard.sol95%100%100%94.12%79
contracts/common/l2-helpers
   L2ContractHelper.sol84.91%100%100%82.22%102, 108, 112, 129, 134, 73, 79, 83
   SystemContractsCaller.sol0%100%0%0%102, 114, 122–125, 128, 135–139, 141–142, 32–34, 37, 44–45, 47, 49, 51, 53, 66, 69, 72, 75, 78, 83, 89, 91, 93, 96, 98
contracts/common/libraries
   DataEncoding.sol85.11%100%100%81.58%109–110, 117–118, 163, 177, 45
   DynamicIncrementalMerkle.sol73.91%100%80%73.17%66–70, 72–74, 76–78
   FullMerkle.sol100%100%100%100%
   Merkle.sol98.15%100%100%97.96%83
   MessageHashing.sol95.16%100%100%94.64%113, 77, 94
   SemVer.sol100%100%100%100%
   UncheckedMath.sol100%100%100%100%
   UnsafeBytes.sol100%100%100%100%
contracts/governance
   AccessControlRestriction.sol100%100%100%100%
   ChainAdmin.sol97.87%100%100%97.30%39
   ChainAdminOwnable.sol44.83%100%40%45.83%28, 38–40, 46–48, 57, 66, 77–79, 81
   Governance.sol100%100%100%100%
   L2ProxyAdminDeployer.sol0%100%0%0%16–18, 20
   PermanentRestriction.sol88.80%100%100%87.39%103, 110–111, 199–200, 203–204, 207, 209–210, 239, 287, 309, 340
   ServerNotifier.sol93.10%100%100%90.91%55, 65
   TransitionaryOwner.sol0%100%0%0%16–17, 21–23
contracts/governance/restriction
   Restriction.sol100%100%100%100%
   RestrictionValidator.sol100%100%100%100%
contracts/l2-upgrades
   L2ComplexUpgrader.sol0%100%0%0%23, 25–26, 40, 45, 47, 57, 63–64, 71, 80–82, 85, 87–88
   L2GenesisForceDeploymentsHelper.sol0%100%0%0%101, 108–109, 112–114, 120, 128, 132, 137, 139, 149, 158, 161, 166, 176, 178–179, 182, 185, 191, 195, 199, 210, 219, 224, 226, 234, 245, 259, 265, 285, 293–294, 297–298, 300, 307, 313, 33–35, 37, 45, 48–49, 54, 60–62, 70–72, 74, 84, 92, 96
   L2GenesisUpgrade.sol0%100%0%0%24, 31–32, 37–38, 42, 50
contracts/state-transition
   AccessControlEnumerablePerChainAddressUpgradeable.sol98.15%100%100%97.67%179
   ChainTypeManager.sol85.93%100%84.62%86.25%111, 123, 129, 137–138, 245–248, 261–264, 279, 409, 471, 499,

@0xValera 0xValera marked this pull request as ready for review September 29, 2025 12:12
@0xValera 0xValera merged commit 348f7b9 into draft-v30 Sep 29, 2025
20 of 22 checks passed
@0xValera 0xValera deleted the sb-adapting-contracts-for-zksync-os-v30 branch September 29, 2025 12:12
0xValera added a commit that referenced this pull request Oct 16, 2025
…ksync-os-v30

Draft: Adapting contracts for zksync os v30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.